<script>
export default {
  name: "Test",
  data() {
    return {
      isShow: true
    }
  }
}
</script>

<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <transition name="t2" appear>
      <h1 v-show="isShow">你好啊！</h1>
    </transition>
  </div>
</template>

<style scoped>
h1 {
  background-color: orange;
}
/*进入的起点*/ /*离开的终点*/
.t2-enter,.t2-leave-to {
  transform: translateX(-100%);
}
/*进入的终点*/ /*离开的起点*/
.t2-enter-to,.t2-leave{
  transform: translateX(0);
}
.t2-enter-active,.t2-leave-active {
  transition: 1s ease;
}



</style>